package spatialmarketplace.cem.dao.implementation;

import java.io.File;
import java.util.Calendar;
import java.util.Random;
import spatialmarketplace.cem.dao.AttachmentDao;
import spatialmarketplace.cem.model.Attachment;
import spatialmarketplace.cem.model.ModelBase;

/**
 * Class that implements the DAO of attachment files when a group is created
 *
 * @author Laura Andreina
 */
public class AttachmentDaoImpl extends DaoImpl<Attachment> implements AttachmentDao {

    private static final String DIRECTORY = "uploads/";

    private AttachmentDaoImpl() {
    }
    private static AttachmentDaoImpl instance = new AttachmentDaoImpl();

    public static AttachmentDaoImpl getInstance() {
        return instance;
    }

    public String getFilePath(Attachment attachment) {
        return DIRECTORY + System.currentTimeMillis() + "_" + attachment.getFileName();
    }
}
